package com.wen.service.Impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wen.mapper.PurchaseOrderMapper;
import com.wen.pojo.PurchaseOrder;
import com.wen.pojo.dto.wen.PurchaseOrderDto;
import com.wen.pojo.dto.wen.PurchaseOrderRKDto;
import com.wen.pojo.dto.wen.PurchaseOrders;
import com.wen.service.PurchaseOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PurchaseOrderServiceImpl extends ServiceImpl<PurchaseOrderMapper, PurchaseOrder> implements PurchaseOrderService {

    @Autowired
    private PurchaseOrderMapper mapper;

    @Override
    public Page<PurchaseOrders> sel(PurchaseOrderDto dto, Integer pageNum, Integer size) {

        Page<PurchaseOrders> page = new Page<>(pageNum, size);
        Page<PurchaseOrders> sel = mapper.sel(page, dto);

        return sel;
    }

    @Override
    public Boolean up(String checkTag, String id) {
        return mapper.up(checkTag, id);
    }

    @Override
    public Page<PurchaseOrders> selCheckTag(PurchaseOrderDto dto, Integer pageNum, Integer size) {

        Page<PurchaseOrders> page = new Page<>(pageNum, size);
        Page<PurchaseOrders> purchaseOrdersPage = mapper.selCheckTag(page, dto);

        return purchaseOrdersPage;
    }

    @Override
    public List<PurchaseOrderRKDto> selRK(String id) {

        List<PurchaseOrderRKDto> purchaseOrderRKDtos = mapper.selRK(id);

        return purchaseOrderRKDtos;
    }
}
